import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Films from '../views/home/Films.vue'
import Cinemas from '../views/home/Cinemas.vue'
import Center from '../views/Center.vue'
import Login from '../views/Center/Login.vue'
import Register from '../views/Center/Register.vue'
import Film from '../views/Film.vue'
import Tickets from '../views/Tickets.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    component: Home,
    redirect: '/films',
    children: [
      {
        path: '/films',
        component: Films
      },
      {
        path: '/cinemas',
        component: Cinemas
      }
    ]
  },
  {
    path: '/center',
    redirect: '/login',
    component: Center,
    children: [
      {
        path: '/login',
        component: Login
      },
      {
        path: '/register',
        component: Register
      }
    ]
  },
  {
    path: '/film',
    component: Film
  },
  {
    path: '/tickets',
    component: Tickets
  },
  {
    path: '*',
    redirect: '/home'
  }
]

const router = new VueRouter({
  routes
})

export default router
